<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- Set 有序不重复的元素集 -->
    <script>
        // const set = new Set()
        const set = new Set([3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8])
        // console.log(set.size);

        /* 数据已经实现了去重 */

        /* 增删改查 */
        set.add(10)
        set.add(10)

        // 删除元素
        // set.delete(5)
        // set.clear()

        console.log(set.has(3));
        console.log(set.has(15));

        console.log(set.keys());
        console.log(set.values());
        console.log(set.entries());
        console.log("------------------");
        for (const iterator of set.values()) {
            console.log(iterator);
        }
        console.log("------------------");

        set.forEach(
            (value, value2,s) => console.log(value, value2)
        )

        // const arr = [...set]
        // const arr = Array.from(set)
        // console.log(arr);
        // console.log(set);
    </script>
</body>

</html>